function AssertException(message) { this.message = message; }
AssertException.prototype.toString = function () {
  return 'AssertException: ' + this.message;
}

function assert(exp, message) {
  if (!exp) {
    throw new AssertException(message);
  }
}


/*
var cards = [];
cards.push(new Card(cardsValue[4], colors[2]));
cards.push(new Card(cardsValue[2], colors[3]));
cards.push(new Card(cardsValue[2], colors[2]));
cards.push(new Card(cardsValue[7], colors[2]));
cards.push(new Card(cardsValue[7], colors[2]));

assert(4, 4)

//var cards = getCards(allHands, 5);
cards.sort(function(a, b) {return a.cardValue - b.cardValue})
displayHands(cards);
*/
/*
$('body').append('<br/>isStraight Flush : ' + isStraightFlush(cards));
$('body').append('<br/>isColor : ' + isColor(cards));
$('body').append('<br/>isStraight : ' + isStraight(cards));
$('body').append('<br/>Four : ' + countKinds(cards, 4));
$('body').append('<br/>Three : ' + countKinds(cards, 3));
$('body').append('<br/>Two Pairs : ' + isTwoPair(cards));
$('body').append('<br/>Two : ' + countKinds(cards, 2));
*/

/*
$('body').append('<br/><br/>getHandValue : ' + getHandValue(cards));

var cards2 = [];
cards2.push(new Card(cardsValue[4], colors[2]));
cards2.push(new Card(cardsValue[2], colors[2]));
cards2.push(new Card(cardsValue[2], colors[3]));
cards2.push(new Card(cardsValue[7], colors[2]));
cards2.push(new Card(cardsValue[7], colors[2]));

cards2.sort(function(a, b) {return a.cardValue - b.cardValue})
displayHands(cards2);

$('body').append('<br/><br/>getHandValue : ' + getHandValue(cards2));

$('body').append('<br/><br/>Compare 2 hands : ' + compareTwoHands(cards,cards2));

*/

function launchTest() {

  
  var cards = [];
  cards.push(new Card(0, colors[2]));
  cards.push(new Card(1, colors[2]));
  cards.push(new Card(2, colors[2]));
  cards.push(new Card(3, colors[2]));
  cards.push(new Card(4, colors[2]));
  var expected = [8, 0];
  assert(expected.toString() == getHandValue(cards).toString(), 'straight Flush broken')	

  var cards = [];
  cards.push(new Card(0, colors[2]));
  cards.push(new Card(1, colors[2]));
  cards.push(new Card(8, colors[2]));
  cards.push(new Card(3, colors[2]));
  cards.push(new Card(4, colors[2]));
  var expected = [5,8,4,3,1,0];
  assert(expected.toString() == getHandValue(cards).toString(), 'Flush broken')	
	

}
launchTest()










